﻿using IOP.Extension.DependencyInjection;
using IOP.SgrA;
using IOP.SgrA.ECS;
using IOP.SgrA.Input;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using System.Text;

namespace VkSample114;

public class InputSystem : ComponentSystem
{

    private Camera Camera;
    [Autowired]
    private IGraphicsManager GraphicsManager { get; set; }

    public override void Initialization()
    {
        base.Initialization();
        GraphicsManager.TryGetCamera("main", out Camera camera);
        Camera = camera;
    }

    public override void Update(TimeSpan timeSpan)
    {
        if (Input.GetMouseButtonState(MouseButton.ButtonLeft).Action == InputAction.Press)
        {
            var delta = Input.GetMousePositionDelta();
            if (delta.X != 0 || delta.Y != 0)
            {
                Camera.EncircleFromMouse(Vector3.Zero, delta.X, delta.Y, (float)(0.2 * Math.PI / 180.0));
            }
        }


    }
}
